import request from '@/utils/request';


export async function getById(projectId, docId) {
    return request(`/project/${projectId}/doc/api/${docId}`, {
        method: 'GET'
    });
}


export async function list(projectId, params) {
    return request(`/project/${projectId}/doc/api/list`, {
        method: 'GET',
        params: params
    });
}

export async function saveApi(projectId, data) {
    return request(`/project/${projectId}/doc/api`, {
        method: 'POST',
        data: data
    });
}

export async function updateApi(projectId, docId, data) {
    return request(`/project/${projectId}/doc/api/${docId}`, {
        method: 'POST',
        data: data
    });
}



export async function listErrorCode(projectId, params) {
    return request(`/project/${projectId}/doc/api/errorCode/list`, {
        method: 'GET',
        params: params
    });
}

export async function saveErrorCode(projectId, data) {
    return request(`/project/${projectId}/doc/api/errorCode`, {
        method: 'POST',
        data: data
    });
}

export async function listErrorCodeDirGroup(projectId) {
    return request(`/project/${projectId}/doc/api/errorCode/dirGroup`, {
        method: 'GET',
    });
}

export async function updateErrorCode(projectId, docId, data) {
    return request(`/project/${projectId}/doc/api/errorCode/${docId}`, {
        method: 'POST',
        data: data
    });
}



export async function listStatusCode(projectId, params) {
    return request(`/project/${projectId}/doc/api/statusCode/list`, {
        method: 'GET',
        params: params
    });
}

export async function saveStatusCode(projectId, data) {
    return request(`/project/${projectId}/doc/api/statusCode`, {
        method: 'POST',
        data: data
    });
}

export async function updateStatusCode(projectId, docId, data) {
    return request(`/project/${projectId}/doc/api/statusCode/${docId}`, {
        method: 'POST',
        data: data
    });
}


export async function listDataModel(projectId, params) {
    return request(`/project/${projectId}/doc/api/dataModel/list`, {
        method: 'GET',
        params: params
    });
}

export async function saveDataModel(projectId, data) {
    return request(`/project/${projectId}/doc/api/dataModel`, {
        method: 'POST',
        data: data
    });
}

export async function updateDataModel(projectId, docId, data) {
    return request(`/project/${projectId}/doc/api/dataModel/${docId}`, {
        method: 'POST',
        data: data
    });
}